﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:rsWPF="clr-namespace:RS.Helper.WPF"
    xmlns:rscoreWPF="clr-namespace:RSCore.Helper.WPF;assembly=RSCore">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Shared.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="{x:Type rsWPF:WindowDecorator}" TargetType="{x:Type rsWPF:WindowDecorator}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Template">
            <Setter.Value>

                <ControlTemplate TargetType="{x:Type rsWPF:WindowDecorator}">

                    <Grid Name="ThisWindow" Background="{StaticResource Brush_WindowBackground}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="25" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <Grid.Resources>
                            <Storyboard x:Key="SetSkinMouseInactive">
                                <Storyboard>
                                    <DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="headerBar" />
                                    <DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="minimize" />
                                    <DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="maximize" />
                                    <DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="close" />
                                    <DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="windowBorder" />
                                </Storyboard>
                            </Storyboard>

                            <Storyboard x:Key="SetSkinMouseActive">
                                <Storyboard>
                                    <DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="headerBar" />
                                    <DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="minimize" />
                                    <DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="maximize" />
                                    <DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="close" />
                                    <DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="windowBorder" />
                                </Storyboard>
                            </Storyboard>
                        </Grid.Resources>

                        <!-- header bar -->
                        <Border x:Name="headerBar" Background="{StaticResource Brush_WindowBackground}"/>

                        <!-- Render Studio -->
                        <StackPanel Orientation="Horizontal" Margin="3,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
                            <TextBlock x:Name="txtRenderStudio" Cursor="Hand" Margin="3,0,0,0" VerticalAlignment="Center" Foreground="{DynamicResource RSColorText}" FontFamily="Tahoma" FontSize="10" Text="Render Studio"/>
                        </StackPanel>

                        <!-- Window buttons -->
                        <Grid Margin="0,5,0,4" Grid.Row="0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="1" />
                                <ColumnDefinition Width="1" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <StackPanel Margin="0,0,10,0" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal" Grid.Column="2">
                                <Button Name="minimize" Style="{DynamicResource Window.BarButton}">
                                    <Viewbox>
                                        <Canvas Height="10" Width="10">
                                            <Rectangle Height="1" Width="10" Fill="{DynamicResource RSColorIcon}" Canvas.Left="0" Canvas.Top="9" />
                                        </Canvas>
                                    </Viewbox>
                                </Button>
                                <Button Name="maximize" Style="{DynamicResource Window.BarButton}">
                                    <Viewbox>
                                        <Canvas Height="10" Width="12" Name="maximizeCanvas">
                                            <Path Data="M18.984,3L18.984,12.984 29.031,12.984 29.031,3 18.984,3z M28.016,11.984L20,11.984 20,6.016 28.016,6.016 28.016,11.984z" Visibility="Hidden" Fill="{DynamicResource RSColorIcon}" Name="maximizeBox2" Canvas.Left="-17" Canvas.Top="-5" />
                                            <Path Data="M18.984,3L18.984,12.984 29.031,12.984 29.031,3 18.984,3z M28.016,11.984L20,11.984 20,6.016 28.016,6.016 28.016,11.984z" Fill="{DynamicResource RSColorIcon}" Name="maximizeBox1" Canvas.Left="-18" Canvas.Top="-2" />
                                        </Canvas>
                                    </Viewbox>
                                </Button>
                                <Button Name="close" Style="{DynamicResource Window.BarButton}">
                                    <Viewbox>
                                        <Canvas Height="10" Width="10">
                                            <Line Fill="{DynamicResource RSColor1ABrush}" X2="9" X1="1" Stroke="{DynamicResource RSColorIcon}" StrokeThickness="1.5" Y2="9" Y1="1" />
                                            <Line Fill="{DynamicResource RSColor1ABrush}" X2="1" X1="9" Stroke="{DynamicResource RSColorIcon}" StrokeThickness="1.5" Y2="9" Y1="1" />
                                        </Canvas>
                                    </Viewbox>
                                </Button>
                            </StackPanel>
                        </Grid>
                        
                        <Grid Grid.Row="1">
                            <ContentPresenter x:Name="contentPresenter"/>
                            <rscoreWPF:UpdatePanel x:Name="updatePanel" />
                        </Grid>

                        <Border Name="windowBorder" Grid.Row="0" Grid.RowSpan="2" BorderBrush="{StaticResource Brush_WindowBorder}" BorderThickness="1"/>

                        <!-- Grip -->
                        <Grid Grid.RowSpan="2">
                            <Line Name="lnSizeNorth"
															  Stroke="Transparent" StrokeThickness="2" Cursor="SizeNS"
															  X1="1" X2="{Binding ElementName=ThisWindow, Path=ActualWidth}"
															  Y1="1" Y2="1"/>

                            <Line Name="lnSizeSouth"
															  Stroke="Transparent" StrokeThickness="2" VerticalAlignment="Bottom" Cursor="SizeNS"
															  X1="1" X2="{Binding ElementName=ThisWindow, Path=ActualWidth}"
															  Y1="{Binding ElementName=ThisWindow, Path=ActuelHeight}" Y2="{Binding ElementName=ThisWindow, Path=ActuelHeight}"/>

                            <Line Name="lnSizeWest"
															  Stroke="Transparent" Cursor="SizeWE" StrokeThickness="2"
															  X1="1" X2="1"
															  Y1="1" Y2="{Binding ElementName=ThisWindow, Path=ActualHeight}"/>

                            <Line Name="lnSizeEast"
															  Stroke="Transparent" StrokeThickness="2" HorizontalAlignment="Right" Cursor="SizeWE"
															  X1="{Binding ElementName=ThisWindow, Path=ActualWidth}" X2="{Binding ElementName=ThisWindow, Path=ActualWidth}"
															  Y1="1" Y2="{Binding ElementName=ThisWindow, Path=ActualHeight}"/>

                            <Rectangle Name="rectSizeNorthWest" Cursor="SizeNWSE" Fill="Transparent" Width="5" Height="5" VerticalAlignment="Top" HorizontalAlignment="Left" />
                            <Rectangle Name="rectSizeNorthEast" Cursor="SizeNESW" Fill="Transparent" Width="5" Height="5" VerticalAlignment="Top" HorizontalAlignment="Right" />
                            <Rectangle Name="rectSizeSouthWest" Cursor="SizeNESW" Fill="Transparent" Width="5" Height="5" VerticalAlignment="Bottom" HorizontalAlignment="Left" />
                            <Rectangle Name="rectSizeSouthEast" Cursor="SizeNWSE" Fill="Transparent" Width="5" Height="5" VerticalAlignment="Bottom" HorizontalAlignment="Right" />
                        </Grid>

                    </Grid>

                </ControlTemplate>

            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>